package com.oracle.oa.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity                        
@Table(name="user_info")
public class Userinfo  implements java.io.Serializable {

	 @GenericGenerator(name = "generator", strategy = "increment")
	 @Id
	 @GeneratedValue(generator = "generator")
	 @Column(name = "userid", unique = true, nullable = false)
     private int userid;
	 @ManyToOne
 	 @JoinColumn(name = "userstate_id")
     private Userstate userstate;
     @ManyToOne
 	 @JoinColumn(name = "roleinfo_id")
     private Roleinfo roleinfo;
     
     @Column(name = "username", length = 64)
     private String username;
     @Column(name = "password", length = 64)
     private String password;
     @ManyToOne
 	 @JoinColumn(name = "depart_id")
     private Departinfo departid;
     
     @Column(name = "gender")
     private int gender;
     //级联操作：cascade = CascadeType.ALL
     //延迟加载：fetch = FetchType.LAZY
     //映射：mappedBy = "category"
     //一对多方式
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set mynotes = new HashSet(0);
     
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set readcommonmessages = new HashSet(0);
     
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set manualsigns = new HashSet(0);
     
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set loginlogs = new HashSet(0);
     
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set fileinfos = new HashSet(0);
     
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set precontracts = new HashSet(0);
     
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set messages = new HashSet(0);
    
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set operatelogs = new HashSet(0);
     
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set schedules = new HashSet(0);
     
     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
     private Set messagetousers = new HashSet(0);
     
     
	public int getUserid() {
		return userid;
	}
	public void setUserid(int userid) {
		this.userid = userid;
	}
	public Userstate getUserstate() {
		return userstate;
	}
	public void setUserstate(Userstate userstate) {
		this.userstate = userstate;
	}
	public Roleinfo getRoleinfo() {
		return roleinfo;
	}
	public void setRoleinfo(Roleinfo roleinfo) {
		this.roleinfo = roleinfo;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public Departinfo getDepartid() {
		return departid;
	}
	public void setDepartid(Departinfo departid) {
		this.departid = departid;
	}
	public int getGender() {
		return gender;
	}
	public void setGender(int gender) {
		this.gender = gender;
	}
	public Set getMynotes() {
		return mynotes;
	}
	public void setMynotes(Set mynotes) {
		this.mynotes = mynotes;
	}
	public Set getReadcommonmessages() {
		return readcommonmessages;
	}
	public void setReadcommonmessages(Set readcommonmessages) {
		this.readcommonmessages = readcommonmessages;
	}
	public Set getManualsigns() {
		return manualsigns;
	}
	public void setManualsigns(Set manualsigns) {
		this.manualsigns = manualsigns;
	}
	public Set getLoginlogs() {
		return loginlogs;
	}
	public void setLoginlogs(Set loginlogs) {
		this.loginlogs = loginlogs;
	}
	public Set getFileinfos() {
		return fileinfos;
	}
	public void setFileinfos(Set fileinfos) {
		this.fileinfos = fileinfos;
	}
	public Set getPrecontracts() {
		return precontracts;
	}
	public void setPrecontracts(Set precontracts) {
		this.precontracts = precontracts;
	}
	public Set getMessages() {
		return messages;
	}
	public void setMessages(Set messages) {
		this.messages = messages;
	}
	public Set getOperatelogs() {
		return operatelogs;
	}
	public void setOperatelogs(Set operatelogs) {
		this.operatelogs = operatelogs;
	}
	public Set getSchedules() {
		return schedules;
	}
	public void setSchedules(Set schedules) {
		this.schedules = schedules;
	}
	public Set getMessagetousers() {
		return messagetousers;
	}
	public void setMessagetousers(Set messagetousers) {
		this.messagetousers = messagetousers;
	}
	@Override
	public String toString() {
		return "Userinfo [userid=" + userid + ", userstate=" + userstate
				+ ", roleinfo=" + roleinfo + ", username=" + username
				+ ", password=" + password + ", departid=" + departid
				+ ", gender=" + gender + ", mynotes=" + mynotes
				+ ", readcommonmessages=" + readcommonmessages
				+ ", manualsigns=" + manualsigns + ", loginlogs=" + loginlogs
				+ ", fileinfos=" + fileinfos + ", precontracts=" + precontracts
				+ ", messages=" + messages + ", operatelogs=" + operatelogs
				+ ", schedules=" + schedules + ", messagetousers="
				+ messagetousers + "]";
	}
	public Userinfo(int userid, Userstate userstate, Roleinfo roleinfo,
			String username, String password, Departinfo departid, int gender,
			Set mynotes, Set readcommonmessages, Set manualsigns,
			Set loginlogs, Set fileinfos, Set precontracts, Set messages,
			Set operatelogs, Set schedules, Set messagetousers) {
		this.userid = userid;
		this.userstate = userstate;
		this.roleinfo = roleinfo;
		this.username = username;
		this.password = password;
		this.departid = departid;
		this.gender = gender;
		this.mynotes = mynotes;
		this.readcommonmessages = readcommonmessages;
		this.manualsigns = manualsigns;
		this.loginlogs = loginlogs;
		this.fileinfos = fileinfos;
		this.precontracts = precontracts;
		this.messages = messages;
		this.operatelogs = operatelogs;
		this.schedules = schedules;
		this.messagetousers = messagetousers;
	}
	public Userinfo() {
		super();
	}
	
}